package com.itly.rwxkw.controller;

import com.itly.rwxkw.pojo.*;
import com.itly.rwxkw.service.VisualizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 罗言
 * @Version: 1.0
 * @Date: 2024-03-07-17:40
 * @Description:
 */
@Controller
@RequestMapping("/vis")
public class VisualizationController {

    @Autowired
    public VisualizationService service;

    @GetMapping("data1")
    @ResponseBody
    public Result getData1() {
        List<VisParam> data = service.getData1();
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @PostMapping("data2")
    @ResponseBody
    public Result getData2(@RequestBody VisParam visParam) {
        List<VisParam> data = service.getData2(visParam.getParam());
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @GetMapping("data3")
    @ResponseBody
    public Result getData3() {
        List<VisParam> data = service.getData3();
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @PostMapping("data4")
    @ResponseBody
    public Result getData4(@RequestBody VisParam visParam) {
        List<VisParam> data = service.getData4(visParam.getParam());
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @GetMapping("data5")
    @ResponseBody
    public Result getData5() {
        List<VisParam> data = service.getData5();
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @PostMapping("data6")
    @ResponseBody
    public Result getData6(@RequestBody VisParam visParam) {
        List<VisParam> data = service.getData6(visParam.getParam());
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @GetMapping("data7")
    @ResponseBody
    public Result getData7() {
        List<VisParam> data = service.getData7();
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @GetMapping("data8")
    @ResponseBody
    public Result getData8() {
        List<VisParam> data = service.getData8();
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @PostMapping("data9")
    @ResponseBody
    public Result getData9(@RequestBody VisParam visParam) {
        List<VisParam> data = service.getData9(visParam.getParam());
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @PostMapping("data10")
    @ResponseBody
    public Result getData10(@RequestBody VisParam visParam) {
        List<VisParam> data = service.getData10(visParam.getParam());
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @GetMapping("data11")
    @ResponseBody
    public Result getData11() {
        Integer count = service.getData11();
        return new Result(count >= 0 ? Code.GET_OK : Code.GET_ERR, count);
    }

    @PostMapping("data12")
    @ResponseBody
    public Result getData12(@RequestBody PageParam param) {
        List<PageData> data = service.getData12(param);
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @GetMapping("data13")
    @ResponseBody
    public Result getData13() {
        List<VisParam> data = service.getData13();
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @PostMapping("data14")
    @ResponseBody
    public Result getData14(@RequestBody VisParam visParam) {
        List<VisParam> data = service.getData14(visParam.getParam());
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @GetMapping("data15")
    @ResponseBody
    public Result getData15() {
        List<VisParam> data = service.getData15();
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }

    @PostMapping("data16")
    @ResponseBody
    public Result getData16(@RequestBody VisParam visParam) {
        List<VisParam> data = service.getData16(visParam.getParam());
        return new Result(data != null ? Code.GET_OK : Code.GET_ERR, data);
    }
}
